Skip to content

JAVA-6187 Upgrade libcrypt version to 1.18.1#1983

Merged
rozza merged 11 commits into
mongodb:mainfrom
strogiyotec:JAVA-6187
May 28, 2026
Merged

JAVA-6187 Upgrade libcrypt version to 1.18.1#1983
rozza merged 11 commits into
mongodb:mainfrom
strogiyotec:JAVA-6187

Conversation

@strogiyotec

@strogiyotec strogiyotec commented May 21, 2026

Copy link
Copy Markdown
Contributor

JAVA-6187
Upgrading libcrypt version to 1.18.1
Also the artifact location got changed from s3 to github

Risks

This PR assumes there is gpg installed that might not be a case in Windows

Resolution of risks

There is a new flag -PskipCryptVerify=true that will skip gpg verification

Warnings (not applicable, I passed --quite as suggested by Ross)

If you run ./gradlew :mongodb-crypt:downloadJnaLib locally it will give a few warnings

> Task :mongodb-crypt:downloadJava UP-TO-DATE
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-x86_64-glibc_2_7-nocrypto-1.18.1.asc
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-s390x-glibc_2_7-nocrypto-1.18.1.asc
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-x86_64-glibc_2_7-nocrypto-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-s390x-glibc_2_7-nocrypto-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-ppc64le-glibc_2_17-nocrypto-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-ppc64le-glibc_2_17-nocrypto-1.18.1.asc
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-arm64-glibc_2_17-nocrypto-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-linux-arm64-glibc_2_17-nocrypto-1.18.1.asc
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-windows-x86_64-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-windows-x86_64-1.18.1.asc
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-macos-universal-1.18.1.tar.gz
Download https://github.com/mongodb/libmongocrypt/releases/download/1.18.1/libmongocrypt-macos-universal-1.18.1.asc
Download https://pgp.mongodb.com/libmongocrypt.pub

> Task :mongodb-crypt:verifyJava
gpg: keybox '/home/almas/repos/mongo-java-driver/mongodb-crypt/build/jnaLibs/gnupg/pubring.kbx' created
gpg: /home/almas/repos/mongo-java-driver/mongodb-crypt/build/jnaLibs/gnupg/trustdb.gpg: trustdb created
gpg: key 81F1404DEBACA586: public key "Libmongocrypt Release Signing Key <packaging@mongodb.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: Signature made Fri May  8 05:08:55 2026 PDT
gpg:                using RSA key F2F5BF4ABF517E039AFCADAA81F1404DEBACA586
gpg: Good signature from "Libmongocrypt Release Signing Key <packaging@mongodb.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.

The reason is because gpg doesn't know if the key is trusted as we arbitrary downloaded it

Running the same command using shell will give the same output
image

@strogiyotec strogiyotec requested a review from a team as a code owner May 21, 2026 15:51
@strogiyotec strogiyotec requested review from Copilot, rozza and vbabanin and removed request for rozza May 21, 2026 15:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the mongodb-crypt module’s bundled libmongocrypt native library download process to use libmongocrypt’s 1.18.1 GitHub release assets (instead of S3) and adds GPG signature verification of the downloaded tarballs.

Changes:

  • Bump libmongocrypt download revision to 1.18.1 and switch download base URL to GitHub releases.
  • Download per-platform tarballs (+ .asc signatures) and extract only the needed native library into the JNA resources directory.
  • Add a Gradle task that verifies tarball signatures via gpg, with an opt-out via -PskipCryptVerify=true.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mongodb-crypt/build.gradle.kts Outdated
Comment thread mongodb-crypt/build.gradle.kts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread mongodb-crypt/build.gradle.kts Outdated
Comment thread mongodb-crypt/build.gradle.kts
Comment thread mongodb-crypt/build.gradle.kts Outdated
Comment thread mongodb-crypt/build.gradle.kts Outdated

@rozza rozza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this. Couple of optional suggestions.

You may want to change the task names downloadJava no longer makes sense as it used to be the java tarball. For example: downloadCryptLibs, verifyCryptLibs and extractCryptLibs make more sense now than downloadJava, verifyJava and unzipJava.

One gripe from the existing implementation, you might want to make downloading optional eg:

 overwrite(false)
  onlyIf { !file("$jnaDownloadsDir/${platform.tarballName}.tar.gz").exists() }

That way it would work without having to check if modified and offline. Also we can bypass this all if jnaLibsPath is set.

@vbabanin vbabanin self-assigned this May 22, 2026
Comment thread mongodb-crypt/build.gradle.kts Outdated
rozza and others added 3 commits May 27, 2026 10:31
- Add key fingerprint validation after import to detect key substitution
- Add verification stamp output file for proper Gradle up-to-date checks
- Remove outputs.upToDateWhen { false } (inputs already track changes)
- Use --no-autostart to prevent gpg-agent launch; remove kill cleanup
- Surface GPG stderr in exception message on verification failure
- Switch extractCryptLibs from Copy to Sync (handles stale files)
- Fix processResources: dependsOn instead of mustRunAfter
- Fix missing path separator in jnaLibsPath construction
- Suppress noisy gpg/download output; use logger.lifecycle
- Add tasks.clean rule for rootProject build/jnaLibs directory
- Remove dead onlyIfModified(true) (no effect with overwrite=false)

JAVA-6187

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread mongodb-crypt/build.gradle.kts
Comment thread mongodb-crypt/build.gradle.kts
Comment thread mongodb-crypt/build.gradle.kts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread mongodb-crypt/build.gradle.kts Outdated
@vbabanin

vbabanin commented May 28, 2026

Copy link
Copy Markdown
Member

Looks good overall. @rozza, I like this update to tighten the verification. Just one comment: #1983 (comment)

LGTM after that.

@rozza rozza merged commit 966abab into mongodb:main May 28, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants